




<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>精确查找</title>
<!-- Bootstrap -->
<link href="./css/bootstrap.min.css"
	rel="stylesheet">
<link href="./css/profile_style.css" rel="stylesheet">
<link href="./css/response.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
      <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="./js/.lib/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="./js/.lib/bootstrap.min.js"></script>
<script src="./js/.lib/style.js"></script>
<script type="text/javascript">
	//当页面加载完成后，初始化省份列表
	$(function (){
		$.ajax({
			url : 'http://www.udppvr.cn:80/profile/initState.do',
			method : 'get',
			success : function (rs){
				for (var i = 0; i < rs.length; i ++) {
					if($("#stateKey").val() == rs[i].addressKey) {
						k = i;
						$("#state").append('<option selected="selected" value="'+rs[i].addressKey+'">'+rs[i].name+'</option>');
					}else{
						$("#state").append('<option value="'+rs[i].addressKey+'">'+rs[i].name+'</option>');
					}						
				}
				$("#state").append('<option value="">全部</option>');
				initCity(rs[k].addressKey);
			},
			dataType : 'json'
		});
		$("#state").on("change",function (){
			initCity($(this).val());	
		});
	});
	function initCity(stateKey){
		$("#city").empty();
		$.ajax({
			url : 'http://www.udppvr.cn:80/profile/initCity.do?stateKey='+stateKey,
			method : 'get',
			success : function (rs){
				for (var i = 0; i < rs.length; i ++) {
					if($("#cityId").val() == rs[i].id) {
						$("#city").append('<option selected="selected" value="'+rs[i].id+'">'+rs[i].name+'</option>');
					}else{						
						$("#city").append('<option value="'+rs[i].id+'">'+rs[i].name+'</option>');						
					}
				}	
				$("#city").append('<option value="">全部</option>');
			},
			dataType : 'json'
		});
	}
	function search(){
		$.ajax({
			url : 'http://www.udppvr.cn:80/profile/search.do',
			method : 'post',
			data : {
				gender : $("#gender").val(),
				cityId : $("#city").val(),
				stateKey : $("#state").val()
			},
			success : function(rs) {
				$("#download").css("display","block");
				$("#downloadMsg").html("<span style='font-size:1.2em;'>共找到记录" + rs.message + "条，每次最多可下载100条记录，输入记录开始位置，点击导出通讯录按钮，即可导出通讯录文件！</span>");
			},
			dataType : 'json'
		});
	}
	function download(){
		var searchDownloadTimes = $("#searchDownloadTimes").val();
		var memberId = $("#memberId").val();
		if (!memberId) {
			$("#modelText").text("您还没有登录，登录后才能下载！");
			$('#myModal').modal();
			return ;
		}
		if (!searchDownloadTimes  || searchDownloadTimes < 1) {
			$("#modelText").text("您的精确下载次数不足，请先购买精确下载次数！");
			$('#myModal').modal();
			return ;
		}else {
			$("#downloadForm").submit();
		}
	}
</script>
</head>
<body style="margin: 0 5px;">
	<div class="prolist">
		<form id="downloadForm" method="post" action="http://www.udppvr.cn:80/profile/downloadSearchRecords.do">
			<div class="form-group input-group">
				<span class="input-group-addon">性别</span>
				<div class="form-control">
					<label class="checkbox-inline"> <input type="radio"
						name="tmember.gender" id="gender_man" value="男"
						checked>男
					</label> <label class="checkbox-inline"> <input type="radio"
						name="tmember.gender" id="gender_woman" value="女"
						>
						女
					</label>
				</div>
			</div>
			<div class="form-group input-group">
				<input type="hidden" id="stateKey"
					value="027" /> <span
					class="input-group-addon">省份</span> <select id="state"
					name="stateKey" class="form-control">
				</select>
			</div>
			<div class="form-group input-group">
				<input type="hidden" id="cityId" value="328" />
				<span class="input-group-addon">城市</span> <select
					name="cityId" id="city" class="form-control">
				</select>
			</div>
			<div style="color : red;"></div>
			<input type="button" class="btn btn-primary btn-lg btn-block"
				value="查找" onclick="javascript:search();" />
				<br />
		<div id="download" style="display : none;">
			<div id="downloadMsg"  class="form-group">
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">开始位置</span> <input
					type="number" class="form-control" id="startPos" name="startPos" value="1" min="1"
					placeholder="开始记录数">
				<input type="hidden" id="memberId" name="id" value="32892"/>
				<input type="hidden" id="searchDownloadTimes" name="searchDownloadTimes" value=""/>
			</div>
			<input type="button" class="btn btn-primary btn-lg btn-block"
				value="导出通讯录" onclick="javascript:download();" />
		</div>
		</form>
		<div class="clearfix"></div>
	</div>
	<nav>
     
<dl>
	<dt>
		<a href="./index.html"><img
			src="./images/nav1.png" width="65" height="35" /></a>
	</dt>
	<dd>
		<a href="./index.html">首页</a>
	</dd>
</dl>
<dl>
	
	<dt>
		<a href="./search.html"><img
			src="./images/nav2.png" width="65" height="35" /></a>
	</dt>
	<dd>
		<a href="./search.html">精确查找</a>
	</dd>
	
	
</dl>
<dl>
	<dt>
		<a href="./novice.html"><img
			src="./images/nav3.png" width="65" height="35" /></a>
	</dt>
	<dd>
		<a href="./novice.html">新手教程</a>
	</dd>
</dl>

<dl>
	<dt>
		<a href="http://www.udppvr.cn:80/profile/toUserCenter.do"><img
			src="./images/nav4.png" width="65" height="35" /></a>
	</dt>
	<dd>
		<a href="http://www.udppvr.cn:80/profile/toUserCenter.do">会员中心</a>
	</dd>
</dl>


<div class="clearfix"></div>
    </nav>
	<!--prolist/-->
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">下载名片夹提示</h4>
				</div>
				<div class="modal-body" id="modelText"></div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
</body>
</html>